package com.weixin.xplore.helper;

import com.weixin.xplore.service.SysSettingBizService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.util.Map;

@Component
@RequiredArgsConstructor
public class IntegralHelper {
    private final SysSettingBizService service;


    /**
     * 人民币根据比例算出积分
     * @param rmb
     * @return
     */
    public BigDecimal getRealIntegral(Long rmb) {
        BigDecimal integralToRMBRate = service.queryValueByKey("integralToRMBRate", BigDecimal.class, BigDecimal.valueOf(100));
        return integralToRMBRate.multiply(BigDecimal.valueOf(rmb));
    }
}
